/*
 * Button.h
 *
 *  Created on: 22/07/2013
 *      Author: vitor
 */

#ifndef BUTTON_H_
#define BUTTON_H_

#include "SDLBase.h"
#include "Sprite.h"
#include "InputManager.h"
#include "Point.h"

class Button {
private:
	SDL_Rect _buttonRect;
	Sprite* _buttonSprite;
	Sprite* _buttonImageSprite;
	Point _position;

	bool _clicked;

public:
	Button(Point position, Sprite* buttonSprite, Sprite* buttonImageSprite);
	virtual ~Button();

	void update();
	void render(float cameraX = 0, float cameraY = 0);

	bool isClicked() const {
		return _clicked;
	}

	const Point& getPosition() const {
		return _position;
	}

	void setPosition(const Point& position) {
		_position = position;
		_buttonRect.x = _position.getX() - _buttonSprite->getWidth() / 2;
		_buttonRect.y = _position.getY() - _buttonSprite->getHeight() / 2;
	}
};

#endif /* BUTTON_H_ */
